package filter;

import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

public class logingOut extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        Object user_session = req.getAttribute("USER_SESSION");

        if(user_session!=null)
        {
            req.getSession().removeAttribute("USER_SESSION");
            resp.sendRedirect("/Servlet_2_war/login1.jsp");
        } else {
            resp.sendRedirect("/Servlet_2_war/login1.jsp");
        }
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
    }
}
